{% extends "base.html" %}

{% block content %}
<div class="container mt-5">
    <h2>进度审核与调整</h2>

    <!-- 进度列表 -->
    <table class="table table-bordered">
        <thead>
            <tr>
                <th>学生姓名</th>
                <th>课题名称</th>
                <th>进度标题</th>
                <th>提交时间</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>张大炮</td>
                <td>毕业设计管理系统开发</td>
                <td>开题报告完成</td>
                <td>2025-04-01 10:00</td>
                <td><span class="badge bg-warning text-dark">待审核</span></td>
                <td>
                    <button class="btn btn-danger btn-sm me-2" onclick="deleteProgress(this)">删除进度</button>
                    <button class="btn btn-info btn-sm" data-bs-toggle="modal" data-bs-target="#editProgressModal">调整进度</button>
                </td>
            </tr>
            <tr>
                <td>张毅</td>
                <td>智能推荐算法研究</td>
                <td>第一阶段总结</td>
                <td>2025-03-25 15:30</td>
                <td><span class="badge bg-success">已通过</span></td>
                <td>
                    <button class="btn btn-danger btn-sm me-2" onclick="deleteProgress(this)">删除进度</button>
                    <button class="btn btn-info btn-sm" data-bs-toggle="modal" data-bs-target="#editProgressModal">调整进度</button>
                </td>
            </tr>
        </tbody>
    </table>
</div>

<!-- 调整进度模态框 -->
<div class="modal fade" id="editProgressModal" tabindex="-1" aria-labelledby="editProgressModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="editProgressModalLabel">调整进度</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <form>
                    <div class="mb-3">
                        <label class="form-label">学生姓名</label>
                        <input type="text" class="form-control" value="张大炮" disabled>
                    </div>
                    <div class="mb-3">
                        <label class="form-label">课题名称</label>
                        <input type="text" class="form-control" value="毕业设计管理系统开发" disabled>
                    </div>
                    <div class="mb-3">
                        <label for="score" class="form-label">评分</label>
                        <input type="number" class="form-control" id="score" value="85">
                    </div>
                    <div class="mb-3">
                        <label for="comment" class="form-label">评语</label>
                        <textarea class="form-control" id="comment" rows="3">内容详实，建议补充相关文献。</textarea>
                    </div>
                    <div class="mb-3">
                        <label for="status" class="form-label">状态</label>
                        <select class="form-select" id="status">
                            <option selected>通过</option>
                            <option>驳回</option>
                        </select>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" onclick="saveEdit()">保存修改</button>
            </div>
        </div>
    </div>
</div>

<!-- JS 脚本实现交互 -->
<script>
function deleteProgress(btn) {
    if (confirm('确定要删除这条进度吗？')) {
        btn.closest('tr').remove();
        alert('进度已删除（演示用）');
    }
}

function saveEdit() {
    alert('评分已更新（演示用）');
    var modal = bootstrap.Modal.getInstance(document.getElementById('editProgressModal'));
    modal.hide();
}
</script>

{% endblock %}
